namespace FIREFLYX {
    /**画一个点 */
    export class DrawPoint implements IExample {
        public Init(canvas: HTMLCanvasElement): void {
            let gl = canvas.getContext("webgl2");
            let vs = `#version 300 es
            in vec4 a_Position;
            void main() {
                gl_Position = a_Position;
                gl_PointSize = 20.0;
            }
            `;

            let fs = `#version 300 es
                precision highp float;
                out vec4 color;
                void main(){
                    color = vec4(1.0,0.0,0.0,1.0);
                }
            `;

            //init Shaders
            let sp = InitShader(gl, vs, fs);
            //使用 gl 程序
            gl.useProgram(sp);

            //set of variables
            //获取 a_Position 内存地址
            let aPositionAddr = gl.getAttribLocation(sp, "a_Position");
            //传递 有效值
            gl.vertexAttrib4f(aPositionAddr, 0.5, 0, 0, 1);

            //绘制
            gl.drawArrays(gl.POINTS, 0, 1);
        }

    }
}